package se;

import java.io.*;
import java.util.Map;

/**
 * Author: hu
 * Date: 2022/2/21 15:31
 */
public class IODemo {
    public static void main(String[] args) throws IOException {
        File f = new File("top/src/se/IODemo.java");
        File f1 = new File("set.txt");
        if(!f1.exists()){
            f1.createNewFile();
        }
      InputStream ins = new FileInputStream(f);
      OutputStream os = new FileOutputStream(f1);
        byte[] b = new byte[100];
        StringBuffer st = new StringBuffer();
        int i=0;
        while((i=ins.read(b))!=-1){
//            System.out.println(new String(b,0,i));
            st.append(new String(b,0,i));
//            os.write(b,0,i);
            System.out.println(i);
        }
        System.out.println(st);


    }
}
